/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package plan;

import java.util.ArrayList;
import java.util.Date;

/**
 *
 * @author phucan
 */
public class PDAImplementation implements PlannerDataAccess {

    ArrayList<Event> list = new ArrayList<>();
long current=new Date().getTime();
long dayTime=24*3600*1000;
    public PDAImplementation() {
        list.add(new Event(1, new Date(current-dayTime*7), 17, 30,"ABC", new EventType(1)));
        list.add(new Event(2, new Date(current-dayTime*6), 8, 0,"Kham benh nhan A", new EventType(1)));
        list.add(new Event(3, new Date(current-dayTime*4), 17, 30,"DEF dee", new EventType(1)));
        list.add(new Event(4, new Date(current+dayTime*1), 14, 30,"Hop", new EventType(2)));
        list.add(new Event(5, new Date(current), 9, 30,"Du lich", new EventType(1)));
        list.add(new Event(6, new Date(current-dayTime*7), 13, 30,"Tai kham", new EventType(2)));
    }

    @Override
    public ArrayList<Event> fetchEvents(Date start, Date end) {
        ArrayList<Event> evs = new ArrayList<>();
        for (Event e : list) {
            if (e.getDate().compareTo(start) >= 0 && e.getDate().compareTo(end) <= 0) {
                evs.add(e);
            }
        }
        return evs;
    }

}
